WinRT Edition Basic Library > Input for WinRT > Input for WinRT Task-Based Help > C1MaskedTextBox Task-Based Help > Locking the Control from Editing |
By default the C1MaskedTextBox control's C1MaskedTextBox.Value property is editable by users at run time. If you want to lock the control from being edited, you can set the IsReadOnly property to True.
At Design Time
To lock the C1MaskedTextBox control from run-time editing, complete the following steps:
This will set the IsReadOnly property to False.
In XAML
To lock the C1MaskedTextBox control from run-time editing in XAML add IsReadOnly="True" to the <Xaml:C1MaskedTextBox> tag so that it appears similar to the following:
Markup |
Copy Code
|
---|---|
<Xaml:C1MaskedTextBox Height="23" Name="C1MaskedTextBox1" Width="120" IsReadOnly="True"></Xaml:C1MaskedTextBox> |
In Code
To lock the C1MaskedTextBox control from run-time editing add the following code to your project:
Visual Basic |
Copy Code
|
---|---|
C1MaskedTextBox1.IsReadOnly = True
|
C# |
Copy Code
|
---|---|
c1MaskedTextBox1.IsReadOnly = true;
|
Run your project and observe:
The control is locked from editing. Try to click the cursor within the control – notice that the text insertion point (the blinking vertical line) will not appear in the control.